<?php


namespace App\Http\Validator;


use App\Http\Common\BaserValidate;

class LoginValidator extends BaserValidate
{
    protected $rule = [
        'username'  =>  'required',
        'password'  =>  'required|regex:/^[0-9a-zA-Z]{8,16}$/',
        'phone'     =>  'required|regex:/^1[34578]\d{9}$/',
        'code'      =>  'required|digits_between:6,6',
        'email'     =>  'required|email:rfc,dns'
    ];

    protected $message = [
        'username.required'         =>  '用户名不能为空',
        'password.required'         =>  '密码不能为空',
        'password.regex'            =>  '密码只能是8-16英文和数字',
        'phone.required'            =>  '手机号码不能为空',
        'phone.regex'               =>  '请输入正确的手机号码',
        'code.required'             =>  '验证码不能为空',
        'code.digits_between'       =>  '验证码长度为6位',
        'email.required'            =>  '邮箱不能为空',
        'email.email'               =>  '请输入正确的邮箱格式'
    ];

    protected $scene = [
        'usernameLogin' =>  ['username', 'password'],
        'sms'           =>  ['phone'],
        'check'         =>  ['phone', 'code'],
        'emailLogin'    =>  ['email', 'password']
    ];
}
